import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'

import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue(),
  createSvgIconsPlugin({
    iconDirs: [path.resolve(process.cwd(),'src/assets/icons')],
    symbolId: 'icon-[dir]-[name]',
  }),
  
],
server: {
  open:true,
  host: '0.0.0.0',
  // https:true,
  port: 6103,
  proxy:{
    '/api':{
      target:'http://127.0.0.1:6789',
      ws:true,
      changeOrigin:true,
      rewrite:(path)=>path.replace(/^\/api/,'')
    }
  }
},
  resolve: {
    alias: {
      "@": path.resolve("./src")
    }
  },
  css:{
    preprocessorOptions:{
      scss:{
        javascriptEnabled:true,
        additionalData:'@import "./src/style/variable.scss";'
      }
    }
  },
  optimizeDeps:{
    include:['lodash.debounce']
  }
})
